home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WCURSOR.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  5.0 KB  |  166 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. #ifndef _WCURSOR_HPP_INCLUDED
  12. #define _WCURSOR_HPP_INCLUDED
  13.  
  14. #ifndef _WNO_PRAGMA_PUSH
  15. #pragma pack(push,8);
  16. #pragma enum int;
  17. #endif
  18.  
  19. #ifndef _WPOINT_HPP_INCLUDED
  20. #  include "wpoint.hpp"
  21. #endif
  22. #ifndef _WRECT_HPP_INCLUDED
  23. #  include "wrect.hpp"
  24. #endif
  25. #ifndef _WRESID_HPP_INCLUDED
  26. #  include "wresid.hpp"
  27. #endif
  28.  
  29. enum WStockCursor {
  30.     WSCPointer,
  31.     WSCCrossHair,
  32.     WSCIBeam,
  33.     WSCSize,
  34.     WSCSizeNESW,
  35.     WSCSizeNS,
  36.     WSCSizeNWSE,
  37.     WSCSizeWE,
  38.     WSCWait,
  39.     WSCNo,
  40.     WSCAppStarting,
  41.     WSCHelp,
  42.     WSCLast = WSCHelp
  43. };
  44.  
  45. enum WCursorColor {
  46.     WCWhite,
  47.     WCBlack,
  48.     WCBlackWhite
  49. };    
  50.  
  51. class WCursorReference;
  52. class WBitmap;
  53.  
  54. class WCMCLASS WCursor : public WObject {
  55.     WDeclareSubclass( WCursor, WObject );
  56.     
  57.     public:
  58.  
  59.         /***************************************************************
  60.          * Constructors and Destructors
  61.          ***************************************************************/
  62.  
  63.         WCursor();
  64.         WCursor( const WResourceID & id, WModuleHandle loadFrom=_ApplicationModule );
  65.         WCursor( const WStockCursor crs );
  66.         WCursor( const WCursorHandle crs, WBool deleteHandle=FALSE );
  67.         WCursor( const WCursor & cursor );
  68.         WCursor( const WChar * file, WBool monochrome );
  69.         WCursor( const WBitmap & bitmap, WPoint hotPoint, WCursorColor color = WCBlack );
  70.     
  71.         ~WCursor();
  72.  
  73.         /***************************************************************
  74.          * Properties
  75.          ***************************************************************/
  76.  
  77.         // Handle
  78.     
  79.         WCursorHandle GetHandle() const;
  80.  
  81.         // Valid
  82.         //
  83.         //     TRUE if cursor was created/loaded.
  84.     
  85.         WBool GetValid() const;
  86.  
  87.         /***************************************************************
  88.          * Methods
  89.          ***************************************************************/
  90.  
  91.         // Clear
  92.  
  93.         void Clear();
  94.  
  95.         // Create
  96.  
  97.         WBool Create( const WResourceID & id, WModuleHandle from=_ApplicationModule );
  98.         WBool Create( const WStockCursor stockCursor );
  99.         WBool Create( const WCursorHandle handle, WBool delHandle=FALSE );
  100.         WBool Create( const WCursor & cursor );
  101.         WBool Create( const WChar * file, WBool monochrome=FALSE );
  102.         WBool Create( const WBitmap & bitmap, WPoint hotPoint, WCursorColor color = WCBlack );
  103.  
  104.         /***************************************************************
  105.          * Static Properties
  106.          ***************************************************************/
  107.  
  108.         // ClipArea
  109.         //
  110.         //     Get or set the clipping area (in screen coordinates) for
  111.         //     the cursor.  A clip area with a width or height of 0
  112.         //     resets the clip area to the whole desktop.
  113.  
  114.         static WRect GetClipArea();
  115.         static WBool SetClipArea( const WRect & r );
  116.  
  117.         // Position
  118.         //
  119.         //     Get or set the position of the cursor on the screen.
  120.         //     Position is in screen coordinates.
  121.  
  122.         static WPoint GetPosition();
  123.         static WBool  SetPosition( const WPoint & pt );
  124.  
  125.         /***************************************************************
  126.          * Static Methods
  127.          ***************************************************************/
  128.  
  129.         // Hide
  130.         //
  131.         //    Decrement the display count for the cursor.  The cursor
  132.         //    is not visible if the display count < 0.  Returns the
  133.         //    new display count.
  134.  
  135.         static WInt Hide();
  136.  
  137.         // Show
  138.         //
  139.         //    Increment the display count for the cursor.  The cursor
  140.         //    is visible only if the display count >= 0.  Returns the
  141.         //    new display count.
  142.  
  143.         static WInt Show();
  144.  
  145.         /***************************************************************
  146.          * Operators
  147.          ***************************************************************/
  148.  
  149.         WCursor & operator=( const WCursor & cursor );
  150.     
  151.         /***************************************************************
  152.          * Data Members
  153.          ***************************************************************/
  154.  
  155.     private:
  156.  
  157.         WCursorReference *      _ref;
  158. };
  159.  
  160. #ifndef _WNO_PRAGMA_PUSH
  161. #pragma enum pop;
  162. #pragma pack(pop);
  163. #endif
  164.  
  165. #endif // _WCURSOR_HPP_INCLUDED
  166.